package com.itheima.exerciseTest.test20_29;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Random;

public class Test27 {
    public static void main(String[] args) {
        Random r = new Random();
        Collection<String> coll = new ArrayList<>();
        /*coll.add("aa");
        coll.add("ee");
        coll.add("cc");
        coll.add("bb");
        coll.add("dd");*/

        for (int i = 0; i < 5; i++) {
            String str = "";
            for (int j = 0; j < 2; j++) {
                str += (char)(r.nextInt(26) + 97);
            }
            coll.add(str);
        }

        Iterator<String> it = coll.iterator();
        while(it.hasNext()){
            System.out.print(it.next() + " ");
        }

        System.out.println("\n================");

        for (String s : coll) {
            System.out.print(s + " ");
        }
    }
}
